package main

// 校验是否完成
func (f *Info) check() {
	select {
	case <-f.ctx.Done():
		return
	default:
		break
	}
	var fail bool
	for k, v := range f.list {
		if k.Wall == One {
			if k.Block == One {
				if v.X != One {
					fail = true
					break
				}
				if v.Y != One {
					fail = true
					break
				}
				if v.Z != Three {
					fail = true
					break
				}
			}
			if k.Block == Two {
				if v.X != Two {
					fail = true
					break
				}
				if v.Y != One {
					fail = true
					break
				}
				if v.Z != Three {
					fail = true
					break
				}
			}
			if k.Block == Three {
				if v.X != Three {
					fail = true
					break
				}
				if v.Y != One {
					fail = true
					break
				}
				if v.Z != Three {
					fail = true
					break
				}
			}
			if k.Block == Four {
				if v.X != One {
					fail = true
					break
				}
				if v.Y != One {
					fail = true
					break
				}
				if v.Z != Two {
					fail = true
					break
				}
			}
			if k.Block == Five {
				if v.X != Two {
					fail = true
					break
				}
				if v.Y != One {
					fail = true
					break
				}
				if v.Z != Two {
					fail = true
					break
				}
			}
			if k.Block == Six {
				if v.X != Three {
					fail = true
					break
				}
				if v.Y != One {
					fail = true
					break
				}
				if v.Z != Two {
					fail = true
					break
				}
			}
			if k.Block == Seven {
				if v.X != One {
					fail = true
					break
				}
				if v.Y != One {
					fail = true
					break
				}
				if v.Z != One {
					fail = true
					break
				}
			}
			if k.Block == Eight {
				if v.X != Two {
					fail = true
					break
				}
				if v.Y != One {
					fail = true
					break
				}
				if v.Z != One {
					fail = true
					break
				}
			}
			if k.Block == Nine {
				if v.X != Three {
					fail = true
					break
				}
				if v.Y != One {
					fail = true
					break
				}
				if v.Z != One {
					fail = true
					break
				}
			}
		}
		if k.Wall == Two {
			if k.Block == One {
				if v.X != Three {
					fail = true
					break
				}
				if v.Y != One {
					fail = true
					break
				}
				if v.Z != Three {
					fail = true
					break
				}
			}
			if k.Block == Two {
				if v.X != Three {
					fail = true
					break
				}
				if v.Y != Two {
					fail = true
					break
				}
				if v.Z != Three {
					fail = true
					break
				}
			}
			if k.Block == Three {
				if v.X != Three {
					fail = true
					break
				}
				if v.Y != Three {
					fail = true
					break
				}
				if v.Z != Three {
					fail = true
					break
				}
			}
			if k.Block == Four {
				if v.X != Three {
					fail = true
					break
				}
				if v.Y != One {
					fail = true
					break
				}
				if v.Z != Two {
					fail = true
					break
				}
			}
			if k.Block == Five {
				if v.X != Three {
					fail = true
					break
				}
				if v.Y != Two {
					fail = true
					break
				}
				if v.Z != Two {
					fail = true
					break
				}
			}
			if k.Block == Six {
				if v.X != Three {
					fail = true
					break
				}
				if v.Y != Three {
					fail = true
					break
				}
				if v.Z != Two {
					fail = true
					break
				}
			}
			if k.Block == Seven {
				if v.X != Three {
					fail = true
					break
				}
				if v.Y != One {
					fail = true
					break
				}
				if v.Z != One {
					fail = true
					break
				}
			}
			if k.Block == Eight {
				if v.X != Three {
					fail = true
					break
				}
				if v.Y != Two {
					fail = true
					break
				}
				if v.Z != One {
					fail = true
					break
				}
			}
			if k.Block == Nine {
				if v.X != Three {
					fail = true
					break
				}
				if v.Y != Three {
					fail = true
					break
				}
				if v.Z != One {
					fail = true
					break
				}
			}
		}
		if k.Wall == Three {
			if k.Block == One {
				if v.X != Three {
					fail = true
					break
				}
				if v.Y != One {
					fail = true
					break
				}
				if v.Z != One {
					fail = true
					break
				}
			}
			if k.Block == Two {
				if v.X != Three {
					fail = true
					break
				}
				if v.Y != Two {
					fail = true
					break
				}
				if v.Z != One {
					fail = true
					break
				}
			}
			if k.Block == Three {
				if v.X != Three {
					fail = true
					break
				}
				if v.Y != Three {
					fail = true
					break
				}
				if v.Z != One {
					fail = true
					break
				}
			}
			if k.Block == Four {
				if v.X != Two {
					fail = true
					break
				}
				if v.Y != One {
					fail = true
					break
				}
				if v.Z != One {
					fail = true
					break
				}
			}
			if k.Block == Five {
				if v.X != Two {
					fail = true
					break
				}
				if v.Y != Two {
					fail = true
					break
				}
				if v.Z != One {
					fail = true
					break
				}
			}
			if k.Block == Six {
				if v.X != Two {
					fail = true
					break
				}
				if v.Y != Three {
					fail = true
					break
				}
				if v.Z != One {
					fail = true
					break
				}
			}
			if k.Block == Seven {
				if v.X != One {
					fail = true
					break
				}
				if v.Y != One {
					fail = true
					break
				}
				if v.Z != One {
					fail = true
					break
				}
			}
			if k.Block == Eight {
				if v.X != One {
					fail = true
					break
				}
				if v.Y != Two {
					fail = true
					break
				}
				if v.Z != One {
					fail = true
					break
				}
			}
			if k.Block == Nine {
				if v.X != One {
					fail = true
					break
				}
				if v.Y != Three {
					fail = true
					break
				}
				if v.Z != One {
					fail = true
					break
				}
			}
		}
		if k.Wall == Four {
			if k.Block == One {
				if v.X != Three {
					fail = true
					break
				}
				if v.Y != Three {
					fail = true
					break
				}
				if v.Z != One {
					fail = true
					break
				}
			}
			if k.Block == Two {
				if v.X != Three {
					fail = true
					break
				}
				if v.Y != Three {
					fail = true
					break
				}
				if v.Z != Two {
					fail = true
					break
				}
			}
			if k.Block == Three {
				if v.X != Three {
					fail = true
					break
				}
				if v.Y != Three {
					fail = true
					break
				}
				if v.Z != Three {
					fail = true
					break
				}
			}
			if k.Block == Four {
				if v.X != Two {
					fail = true
					break
				}
				if v.Y != Three {
					fail = true
					break
				}
				if v.Z != One {
					fail = true
					break
				}
			}
			if k.Block == Five {
				if v.X != Two {
					fail = true
					break
				}
				if v.Y != Three {
					fail = true
					break
				}
				if v.Z != Two {
					fail = true
					break
				}
			}
			if k.Block == Six {
				if v.X != Two {
					fail = true
					break
				}
				if v.Y != Three {
					fail = true
					break
				}
				if v.Z != Three {
					fail = true
					break
				}
			}
			if k.Block == Seven {
				if v.X != One {
					fail = true
					break
				}
				if v.Y != Three {
					fail = true
					break
				}
				if v.Z != One {
					fail = true
					break
				}
			}
			if k.Block == Eight {
				if v.X != One {
					fail = true
					break
				}
				if v.Y != Three {
					fail = true
					break
				}
				if v.Z != Two {
					fail = true
					break
				}
			}
			if k.Block == Nine {
				if v.X != One {
					fail = true
					break
				}
				if v.Y != Three {
					fail = true
					break
				}
				if v.Z != Three {
					fail = true
					break
				}
			}
		}
		if k.Wall == Five {
			if k.Block == One {
				if v.X != One {
					fail = true
					break
				}
				if v.Y != Three {
					fail = true
					break
				}
				if v.Z != One {
					fail = true
					break
				}
			}
			if k.Block == Two {
				if v.X != One {
					fail = true
					break
				}
				if v.Y != Three {
					fail = true
					break
				}
				if v.Z != Two {
					fail = true
					break
				}
			}
			if k.Block == Three {
				if v.X != One {
					fail = true
					break
				}
				if v.Y != Three {
					fail = true
					break
				}
				if v.Z != Three {
					fail = true
					break
				}
			}
			if k.Block == Four {
				if v.X != One {
					fail = true
					break
				}
				if v.Y != Two {
					fail = true
					break
				}
				if v.Z != One {
					fail = true
					break
				}
			}
			if k.Block == Five {
				if v.X != One {
					fail = true
					break
				}
				if v.Y != Two {
					fail = true
					break
				}
				if v.Z != Two {
					fail = true
					break
				}
			}
			if k.Block == Six {
				if v.X != One {
					fail = true
					break
				}
				if v.Y != Two {
					fail = true
					break
				}
				if v.Z != Three {
					fail = true
					break
				}
			}
			if k.Block == Seven {
				if v.X != One {
					fail = true
					break
				}
				if v.Y != One {
					fail = true
					break
				}
				if v.Z != One {
					fail = true
					break
				}
			}
			if k.Block == Eight {
				if v.X != One {
					fail = true
					break
				}
				if v.Y != One {
					fail = true
					break
				}
				if v.Z != Two {
					fail = true
					break
				}
			}
			if k.Block == Nine {
				if v.X != One {
					fail = true
					break
				}
				if v.Y != One {
					fail = true
					break
				}
				if v.Z != Three {
					fail = true
					break
				}
			}
		}
		if k.Wall == Six {
			if k.Block == One {
				if v.X != One {
					fail = true
					break
				}
				if v.Y != Three {
					fail = true
					break
				}
				if v.Z != Three {
					fail = true
					break
				}
			}
			if k.Block == Two {
				if v.X != Two {
					fail = true
					break
				}
				if v.Y != Three {
					fail = true
					break
				}
				if v.Z != Three {
					fail = true
					break
				}
			}
			if k.Block == Three {
				if v.X != Three {
					fail = true
					break
				}
				if v.Y != Three {
					fail = true
					break
				}
				if v.Z != Three {
					fail = true
					break
				}
			}
			if k.Block == Four {
				if v.X != One {
					fail = true
					break
				}
				if v.Y != Two {
					fail = true
					break
				}
				if v.Z != Three {
					fail = true
					break
				}
			}
			if k.Block == Five {
				if v.X != Two {
					fail = true
					break
				}
				if v.Y != Two {
					fail = true
					break
				}
				if v.Z != Three {
					fail = true
					break
				}
			}
			if k.Block == Six {
				if v.X != Three {
					fail = true
					break
				}
				if v.Y != Two {
					fail = true
					break
				}
				if v.Z != Three {
					fail = true
					break
				}
			}
			if k.Block == Seven {
				if v.X != One {
					fail = true
					break
				}
				if v.Y != One {
					fail = true
					break
				}
				if v.Z != Three {
					fail = true
					break
				}
			}
			if k.Block == Eight {
				if v.X != Two {
					fail = true
					break
				}
				if v.Y != One {
					fail = true
					break
				}
				if v.Z != Three {
					fail = true
					break
				}
			}
			if k.Block == Nine {
				if v.X != Three {
					fail = true
					break
				}
				if v.Y != One {
					fail = true
					break
				}
				if v.Z != Three {
					fail = true
					break
				}
			}
		}
	}
	if fail {
		return
	}
	f.exit <- f.record
	f.cancel()
}
